package com.lyhui.nursinguser5010.service.impl;

import com.lyhui.nursinguser5010.pojo.HealthRecord;
import com.lyhui.nursinguser5010.dao.HealthRecordMapper;
import com.lyhui.nursinguser5010.service.HealthRecordService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * HealthRecord表的服务实现类
 *
 * @author lyhui
 * @create-time 2020-02-19 00:35:48
 */
@Service("healthRecordService")
public class HealthRecordServiceImpl implements HealthRecordService {
    //private static final Logger logger = LoggerFactory.getLogger(HealthRecordServiceImpl.class);
    
    @Resource
    private HealthRecordMapper healthRecordMapper;
    
    /**
     * 查询HealthRecord表的所有记录
     *
     * @return HealthRecord的实例对象集合List（封装了HealthRecord表的所有记录）
     */
    @Override
    public List<HealthRecord> queryAllHealthRecord() {
        return this.healthRecordMapper.queryAllHealthRecord();
    }
    
    /**
     * 查询HealthRecord表中的一条记录
     *
     * @param  healthRecord（封装了相关查询条件）
     * @return HealthRecord的实例对象（封装了HealthRecord表的一条记录）
     */
     @Override
    public HealthRecord queryHealthRecordByParam(HealthRecord healthRecord){
        if(healthRecord==null){
            return null;
        }
        return this.healthRecordMapper.queryHealthRecordByParam(healthRecord);
    }
    
    /**
     * 查询HealthRecord表中的多条记录
     *
     * @param  healthRecord（封装了相关查询条件）
     * @return HealthRecord的实例对象集合List（封装了HealthRecord表的多条记录）
     */
    public List<HealthRecord> queryHealthRecordListByParam(HealthRecord healthRecord){
        if(healthRecord==null){
            return null;
        }
        return this.healthRecordMapper.queryHealthRecordListByParam(healthRecord);
    }
    
    /**
     * 在HealthRecord表中的添加一条记录
     *
     * @param  healthRecord（封装了想要添加的记录信息）
     * @return 添加记录的反馈结果(1:添加记录成功；0：添加记录失败)
     */
    @Override
    public int insertHealthRecord(HealthRecord healthRecord) {
        if(healthRecord==null){
            return 0;
        }
        return this.healthRecordMapper.insertHealthRecord(healthRecord);
    }

    /**
     * 修改HealthRecord表中的一条记录
     *
     * @param  healthRecord（封装了准备修改的记录信息）
     * @return 修改记录的反馈结果(1:修改记录成功；0：修改记录失败)
     */
    @Override
    public int updateHealthRecord(HealthRecord healthRecord) {
        if(healthRecord==null){
            return 0;
        }
        return this.healthRecordMapper.updateHealthRecord(healthRecord);
    }

    /**
     * 删除HealthRecord表中的一条记录
     *
     * @param  recordId ： HealthRecord表的主键
     * @return 删除记录反馈结果(1：删除记录成功|0：删除记录失败)
     */
    @Override
    public int deleteHealthRecordById(Integer recordId) {
        if(recordId==null){
            return 0;
        }
        return this.healthRecordMapper.deleteHealthRecordById(recordId);
    }
}